import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FlatrentalInfoVO, FlatrentalInfoForm, FlatrentalInfoQuery } from '@/api/zichanguanli/flatrentalInfo/types';

/**
 * 查询公寓租赁信息列表
 * @param query
 * @returns {*}
 */

export const listFlatrentalInfo = (query?: FlatrentalInfoQuery): AxiosPromise<FlatrentalInfoVO[]> => {
  return request({
    url: '/zichanguanli/flatrentalInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询公寓租赁信息详细
 * @param id
 */
export const getFlatrentalInfo = (id: string | number): AxiosPromise<FlatrentalInfoVO> => {
  return request({
    url: '/zichanguanli/flatrentalInfo/' + id,
    method: 'get'
  });
};

/**
 * 查询公寓租赁历史信息详细
 * @param id
 */
export const getFlathistoryRental = (id: string | number): AxiosPromise<FlatrentalInfoVO> => {
  return request({
    url: '/zichanguanli/flathistoryRental/' + id,
    method: 'get'
  });
};

/**
 * 新增公寓租赁信息
 * @param data
 */
export const addFlatrentalInfo = (data: FlatrentalInfoForm) => {
  return request({
    url: '/zichanguanli/flatrentalInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改公寓租赁信息
 * @param data
 */
export const updateFlatrentalInfo = (data: FlatrentalInfoForm) => {
  return request({
    url: '/zichanguanli/flatrentalInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除公寓租赁信息
 * @param id
 */
export const delFlatrentalInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/flatrentalInfo/' + id,
    method: 'delete'
  });
};
